package de.tum.in.eist.poll.shared;

public class Validation
{
	public static int validateStudentLogin(String input)
	{
		// when input-length is less then 8
		if (input.length() == 8) {
			// trys to parse the Input-String to an Int
			// if it fails, an exceptions gets thrown and you must try
			// again
			try {
				Long.parseLong(input);
			} catch (NumberFormatException e) {
				return 1;
			}
		}
		if (input.length() < 8) {

			return 2;
		}
		if (input.length() > 8) {
			return 3;
		}
		// if parsing gone well, return true, that the input MIGHT
		// be an valid input
		return 0;
	}
	public static boolean isValidStudentLogin(String input)
	{
		if (validateStudentLogin(input) == 0)
			return true;
		
		return false;
	}
}
